//
//  SQEmergencyRescueTableViewCell.m
//  energy
//
//  Created by 苏青 on 2021/9/30.
//

#import "SQEmergencyRescueTableViewCell.h"
#import "SQReleaseModel.h"
#import "NSString+NCDate.h"
@implementation SQEmergencyRescueTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)setModel:(BaseModel<BaseCellModelProtocol> *)model{
    SQReleaseModelData * dataModel = model;
  
    self.lab_er_plan_text.text = dataModel.er_plan_text;
    self.lab_er_grade_text.text = dataModel.er_grade_text;
    self.lab_er_start_date.text = [NSString formateDateToDay:[dataModel.er_start_date substringWithRange:NSMakeRange(6,13)]];

    self.lab_er_number.text = dataModel.er_number;
    
    NSArray *a1 = [dataModel.er_responsible_text componentsSeparatedByString:@","];
      NSMutableArray *all = @[].mutableCopy;
      for (NSString *str in a1) {
          NSArray *a2 = [str componentsSeparatedByString:@"、"];
          [all addObject:a2.firstObject];
      }
    self.lab_er_responsible_text.text = [all componentsJoinedByString:@","];
//    if ([dataModel.er_status isEqualToString:@"0"]) {
//        self.lab_er_status.text = @"响应状态:    救援中";
//        self.btn_add.hidden = NO;
//        self.btn_adjustment.hidden = NO;
//        self.btn_end.hidden = NO;
//        [self.btn_end setTitle:@"结束应急响应" forState:UIControlStateNormal];
//        self.btn_end.backgroundColor = [UIColor colorNamed:@"ff00Color"];
//        [self.btn_adjustment setTitle:@"调整响应级别" forState:UIControlStateNormal];
//        self.btn_adjustment.backgroundColor = [UIColor colorNamed:@"577eb0Color"];
//    }else if ([dataModel.er_status isEqualToString:@"1"]){
//        self.lab_er_status.text = @"响应状态:    已完成";
//        self.btn_add.hidden = YES;
//        self.btn_adjustment.hidden = NO;
//        self.btn_end.hidden = NO;
//        [self.btn_adjustment setTitle:@"拨打电话" forState:UIControlStateNormal];
//        self.btn_adjustment.backgroundColor = [UIColor colorNamed:@"577eb0Color"];
//        [self.btn_end setTitle:@"查看预案" forState:UIControlStateNormal];
//        self.btn_end.backgroundColor = [UIColor colorNamed:@"577eb0Color"];
//    }
    
}

- (IBAction)clickLook:(UIButton *)sender {
    self.cellTitleIndex(@"look",(int)self.indexPath.row);
}


- (IBAction)clickMeasures:(UIButton *)sender {
    self.cellTitleIndex(@"measures",(int)self.indexPath.row);
}

- (IBAction)clickPhone:(UIButton *)sender {
    self.cellTitleIndex(@"phone",(int)self.indexPath.row);
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
